home *** CD-ROM | disk | FTP | other *** search
- ;void vertical_line(vrt_char,top_col,top_row,depth);
- ; unsigned char vrt_char,top_col,top_row,depth;
-
- EXTRN _memory_model:byte
- EXTRN _video_buffer:word
- EXTRN _snow_protect:byte
-
- _TEXT SEGMENT BYTE PUBLIC 'CODE'
- ASSUME CS:_TEXT
- PUBLIC _vertical_line
- _vertical_line proc near
- push bp ;
- mov bp,sp ;set stack frame
- push di ;
- push si ;
- cmp _memory_model,0 ;near or far?
- jle begin ;jump if near
- inc bp ;else add 2 to BP
- inc bp ;
- begin: mov ax,_video_buffer ;fetch _video_buffer
- mov es,ax ;ES pts to screen
- sub ax,ax ;
- mov al,[bp+8] ;get row
- dec ax ;count from 0
- mov dl,160 ;bytes in a row
- mul dl ;times rows
- sub dx,dx ;
- mov dl,[bp+6] ;get column
- dec dx ;count from 0
- shl dx,1 ;double for attributes
- add ax,dx ;add to row offset
- mov di,ax ;ES:DI pts to first char
- mov cl,[bp+10] ;depth in CL
- cmp cl,1 ;test for 0 or 1
- jnbe K1 ;jump if OK
- jmp V1 ;else quit routine
- K1: sub cl,2 ;subtract 2 for end chars
- mov al,[bp+4] ;ln thickness code in BL
- mov ch,0b3h ;assume single vert line
- mov dx,0d7ceh ;center chars for dbl ln
- mov bl,0cdh ;dbl horz char to BL
- cmp al,'D' ;double line?
- je L1 ;jump ahead if so
- cmp al,'d' ;double line?
- je L1 ;jump ahead if so
- jmp short N1 ;else skip over dbl code
- L1: mov ch,0bah ;dbl vert char to CH
- mov si,0d0cah ;chars for other end
- mov [bp+10],si ;place on stack
- mov al,0ffh ;request char from scrn
- call Writeit ;go write char
- cmp al,bl ;double horizontal char?
- jne M1 ;jump ahead if not
- mov al,0cbh ;char for double,double
- jmp short P1 ;ready to go, jump ahead
- M1: mov al,0d2h ;char for double,single
- jmp short P1 ;ready to go, jump ahead
- N1: mov dx,0c5d8h ;center chars for single
- mov si,0c1cfh ;chars for other end
- mov [bp+10],si ;place on stack
- mov al,0ffh ;request char from scrn
- call Writeit ;go write char
- cmp al,bl ;double horizontal char?
- jne O1 ;jump ahead if not
- mov al,0d1h ;char for single,double
- jmp short P1 ;ready to go, jump ahead
- O1: mov al,0c2h ;char for single,single
- P1: mov ah,al ;save in AH
- mov al,0ffh ;request char from scrn
- inc di ;forward to attri byte
- call Writeit ;go write char
- dec di ;pull back ptr
- xchg ah,al ;attri high, char low
- call Writeit ;go write char
- add di,158 ;forward to next row
- mov bx,0c4cdh ;horizontal chars in BX
- or cl,cl ;any straight chars?
- jz U1 ;jump ahead if not
- Q1: mov al,0ffh ;request char from scrn
- call Writeit ;go write char
- cmp al,bl ;double horizontal char?
- je S1 ;jump ahead if so
- mov al,0ffh ;request char from scrn
- call Writeit ;go write char
- cmp al,bh ;single horizontal char?
- je R1 ;jump ahead if not so
- mov al,ch ;vertical char to AL
- jmp short T1 ;go write it
- R1: mov al,dh ;single center char to AL
- jmp short T1 ;go print it
- S1: mov al,dl ;double center char to AL
- T1: call Writeit ;go write char
- add di,158 ;forward to next row
- mov al,ch ;restore vertical char
- jcxz V1 ;quit if CH cleared below
- dec cl ;decrement counter
- jnz Q1 ;loop until 0
- U1: mov dx,[bp+10] ;end chars to DX
- sub ch,ch ;clear CH
- jmp short Q1 ;go write end char
- V1: sti ;reenable interrupts
- pop si ;
- pop di ;
- pop bp ;
- cmp _memory_model,0 ;quit
- jle quit ;
- db 0CBh ;RET far
- quit: ret ;RET near
- _vertical_line endp
- Writeit PROC
- push dx ;save DS
- cld ;set direction flag
- cmp al,0ffh ;FF=return video char
- je D1 ;jump, return char in AL
- mov dx,es ;video buffer segment
- cmp dx,0b800h ;test for graphics card
- jb C1 ;jump if not graphics
- mov dx,3dah ;status byte address
- mov bx,ax ;save contents of AX
- A1: in al,dx ;get status byte
- test al,1 ;test bit
- jnz A1 ;loop till 0
- cli ;disable interrupts
- B1: in al,dx ;get status byte
- test al,1 ;test bit
- jz B1 ;loop till 1
- mov ax,bx ;return character to AX
- C1: stosw ;write the character
- jmp short H1 ;jump ahead
- D1: mov dx,es ;ES pts to video buffer
- cmp _snow_protect,0 ;protect against snow?
- je G1 ;jump ahead if so
- mov dx,3dah ;status byte address
- E1: in al,dx ;get status byte
- test al,1 ;test bit
- jnz E1 ;loop till 0
- cli ;disable interrupts
- F1: in al,dx ;get status byte
- test al,1 ;test bit
- jz F1 ;loop till 1
- G1: mov al,es:[di] ;get char for return
- H1: pop dx ;restore DX and quit
- ret ;
- Writeit endp
- _TEXT ENDS
- END